/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('bpstudio', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AppFailBackRequest {
  applicationId?: string(name='ApplicationId', description='The application ID.', example='61ZW1DY5Y3FSAOO2'),
}

model AppFailBackResponseBody = {
  code?: string(name='Code', description='The response code.', example='200'),
  data?: int32(name='Data', description='The disaster recovery switchback task ID.', example='3309'),
  message?: string(name='Message', description='The returned message. If the request was successful, a success message is returned. If the request failed, an error message is returned.', example='OKITHEVRQCN6ULQG'),
  requestId?: string(name='RequestId', description='The request ID.', example='7036DDBE-0ABA-52D7-A39D-75E511970F07'),
}

model AppFailBackResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AppFailBackResponseBody(name='body'),
}

/**
 * @summary Switches a disaster recovery application back to the primary zone.
 *
 * @description You can call this operation to switch a disaster recovery application back to the primary zone.
 *
 * @param request AppFailBackRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AppFailBackResponse
 */
async function appFailBackWithOptions(request: AppFailBackRequest, runtime: Util.RuntimeOptions): AppFailBackResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AppFailBack',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Switches a disaster recovery application back to the primary zone.
 *
 * @description You can call this operation to switch a disaster recovery application back to the primary zone.
 *
 * @param request AppFailBackRequest
 * @return AppFailBackResponse
 */
async function appFailBack(request: AppFailBackRequest): AppFailBackResponse {
  var runtime = new Util.RuntimeOptions{};
  return appFailBackWithOptions(request, runtime);
}

model AppFailOverRequest {
  applicationId?: string(name='ApplicationId', description='The application ID.', example='BE68D71ZY5YYIU9R'),
  failZone?: string(name='FailZone', description='The destination zone to which you want to switch the disaster recovery application.', example='cn-hangzhou-g'),
}

model AppFailOverResponseBody = {
  code?: string(name='Code', description='The response code.', example='200'),
  data?: int32(name='Data', description='The disaster recovery switchover task ID.', example='7441'),
  message?: string(name='Message', description='The returned message. If the request was successful, a success message is returned. If the request failed, an error message is returned.', example='Success'),
  requestId?: string(name='RequestId', description='The request ID.', example='9656C816-1E9A-58D2-86D5-710678D61AF1'),
}

model AppFailOverResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AppFailOverResponseBody(name='body'),
}

/**
 * @summary Switches a disaster recovery application to another supported zone.
 *
 * @description You can call this operation to switch a disaster recovery application to another supported zone.
 *
 * @param request AppFailOverRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AppFailOverResponse
 */
async function appFailOverWithOptions(request: AppFailOverRequest, runtime: Util.RuntimeOptions): AppFailOverResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.failZone)) {
    body['FailZone'] = request.failZone;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AppFailOver',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Switches a disaster recovery application to another supported zone.
 *
 * @description You can call this operation to switch a disaster recovery application to another supported zone.
 *
 * @param request AppFailOverRequest
 * @return AppFailOverResponse
 */
async function appFailOver(request: AppFailOverRequest): AppFailOverResponse {
  var runtime = new Util.RuntimeOptions{};
  return appFailOverWithOptions(request, runtime);
}

model ChangeResourceGroupRequest {
  newResourceGroupId?: string(name='NewResourceGroupId', description='The ID of the new resource group.

This parameter is required.', example='rg-aek2ajbjoloa23q'),
  resourceId?: string(name='ResourceId', description='The ID of the resource.

This parameter is required.', example='P7RMVSVM9LOVYQOM'),
  resourceType?: string(name='ResourceType', description='The type of the resource for which you want to change the resource group. Valid values: APPLICATION and TEMPLATE.

This parameter is required.', example='APPLICATION'),
}

model ChangeResourceGroupResponseBody = {
  code?: long(name='Code', description='The HTTP status code. A value of 200 indicates that the request is successful. Other values indicate that the request failed.', example='200'),
  data?: string(name='Data', description='No business data is returned for this parameter.', example='No business data is returned for this parameter.'),
  message?: string(name='Message', description='The error message returned if the request failed.', example='Success'),
  requestId?: string(name='RequestId', description='The request ID.', example='A3488F1D-C444-17D0-BA4F-5374BA0F3562'),
}

model ChangeResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChangeResourceGroupResponseBody(name='body'),
}

/**
 * @summary Changes the resource group to which an application or template belongs.
 *
 * @param request ChangeResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroupWithOptions(request: ChangeResourceGroupRequest, runtime: Util.RuntimeOptions): ChangeResourceGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.newResourceGroupId)) {
    body['NewResourceGroupId'] = request.newResourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    body['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    body['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ChangeResourceGroup',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Changes the resource group to which an application or template belongs.
 *
 * @param request ChangeResourceGroupRequest
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroup(request: ChangeResourceGroupRequest): ChangeResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeResourceGroupWithOptions(request, runtime);
}

model CreateApplicationRequest {
  areaId?: string(name='AreaId', description='The ID of the region.', example='cn-hangzhou'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='1600765710019'),
  configuration?: map[string]string(name='Configuration', description='The parameters that are used to configure the application you want to create. For example, enableMonitor specifies whether to automatically create a CloudMonitor task for the application, and enableReport specifies whether to generate reports.', example='{"enableMonitor":"0", "enableReport":"1"}'),
  instances?: [ 
    {
      id?: string(name='Id', description='The ID of the instance.', example='vpc-bp1q56trhtaq40vlq5ojm'),
      nodeName?: string(name='NodeName', description='The name of the instance.', example='vpc'),
      nodeType?: string(name='NodeType', description='The type of the instance.', example='vpc'),
    }
  ](name='Instances', description='The instances in which you want to create the application. You can create applications in an existing virtual private cloud (VPC).'),
  name?: string(name='Name', description='The name of the application.

*   The application name must be unique. You can call the [ListApplication](https://www.alibabacloud.com/help/en/bp-studio/latest/api-bpstudio-2021-09-31-listapplication) operation to query the existing applications.
*   The application name must be 2 to 128 characters in length. The name must start with a letter and cannot start with `http:// or https://`. The name can contain letters, digits, underscores (_), and hyphens (-).

This parameter is required.', example='cadt-application'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the application you want to create belongs.', example='rg-acfmyjt3c5om3hi'),
  templateId?: string(name='TemplateId', description='The ID of the template.

This parameter is required.', example='0KSHPM6SJU03TNZP'),
  variables?: map[string]any(name='Variables', description='The parameter values that are contained in the template. If the template contains no parameter values, the default values are used.', example='{"variable1":"1"}'),
}

model CreateApplicationShrinkRequest {
  areaId?: string(name='AreaId', description='The ID of the region.', example='cn-hangzhou'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='1600765710019'),
  configurationShrink?: string(name='Configuration', description='The parameters that are used to configure the application you want to create. For example, enableMonitor specifies whether to automatically create a CloudMonitor task for the application, and enableReport specifies whether to generate reports.', example='{"enableMonitor":"0", "enableReport":"1"}'),
  instancesShrink?: string(name='Instances', description='The instances in which you want to create the application. You can create applications in an existing virtual private cloud (VPC).'),
  name?: string(name='Name', description='The name of the application.

*   The application name must be unique. You can call the [ListApplication](https://www.alibabacloud.com/help/en/bp-studio/latest/api-bpstudio-2021-09-31-listapplication) operation to query the existing applications.
*   The application name must be 2 to 128 characters in length. The name must start with a letter and cannot start with `http:// or https://`. The name can contain letters, digits, underscores (_), and hyphens (-).

This parameter is required.', example='cadt-application'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the application you want to create belongs.', example='rg-acfmyjt3c5om3hi'),
  templateId?: string(name='TemplateId', description='The ID of the template.

This parameter is required.', example='0KSHPM6SJU03TNZP'),
  variablesShrink?: string(name='Variables', description='The parameter values that are contained in the template. If the template contains no parameter values, the default values are used.', example='{"variable1":"1"}'),
}

model CreateApplicationResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  data?: string(name='Data', description='The ID of the application.', example='002XWH7MXB8MJRU0'),
  message?: string(name='Message', description='The error message.', example='Success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model CreateApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateApplicationResponseBody(name='body'),
}

/**
 * @summary Creates an application based on an official template or private template in Cloud Architect Design Tool (CADT). Before you call this operation, make sure that you understand the billing methods and prices of Alibaba Cloud services to be used in the application.
 *
 * @param tmpReq CreateApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateApplicationResponse
 */
async function createApplicationWithOptions(tmpReq: CreateApplicationRequest, runtime: Util.RuntimeOptions): CreateApplicationResponse {
  Util.validateModel(tmpReq);
  var request = new CreateApplicationShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.configuration)) {
    request.configurationShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.configuration, 'Configuration', 'json');
  }
  if (!Util.isUnset(tmpReq.instances)) {
    request.instancesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instances, 'Instances', 'json');
  }
  if (!Util.isUnset(tmpReq.variables)) {
    request.variablesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.variables, 'Variables', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.areaId)) {
    body['AreaId'] = request.areaId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.configurationShrink)) {
    body['Configuration'] = request.configurationShrink;
  }
  if (!Util.isUnset(request.instancesShrink)) {
    body['Instances'] = request.instancesShrink;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.variablesShrink)) {
    body['Variables'] = request.variablesShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates an application based on an official template or private template in Cloud Architect Design Tool (CADT). Before you call this operation, make sure that you understand the billing methods and prices of Alibaba Cloud services to be used in the application.
 *
 * @param request CreateApplicationRequest
 * @return CreateApplicationResponse
 */
async function createApplication(request: CreateApplicationRequest): CreateApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return createApplicationWithOptions(request, runtime);
}

model DeleteApplicationRequest {
  applicationId?: string(name='ApplicationId', description='The ID of the application.

This parameter is required.', example='002XWH7MXB8MJRU0'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmyjt3c5om3hi'),
}

model DeleteApplicationResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  message?: string(name='Message', description='The error message.', example='Success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model DeleteApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteApplicationResponseBody(name='body'),
}

/**
 * @summary Deletes an application.
 *
 * @description Before you call this operation to delete an application, make sure that the application is in the `Destroyed_Success` state. Otherwise, the application fails to be deleted.`` You can call the [GetApplication](https://www.alibabacloud.com/help/en/bp-studio/latest/api-bpstudio-2021-09-31-getapplication) operation to query the status of an application.
 *
 * @param request DeleteApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteApplicationResponse
 */
async function deleteApplicationWithOptions(request: DeleteApplicationRequest, runtime: Util.RuntimeOptions): DeleteApplicationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes an application.
 *
 * @description Before you call this operation to delete an application, make sure that the application is in the `Destroyed_Success` state. Otherwise, the application fails to be deleted.`` You can call the [GetApplication](https://www.alibabacloud.com/help/en/bp-studio/latest/api-bpstudio-2021-09-31-getapplication) operation to query the status of an application.
 *
 * @param request DeleteApplicationRequest
 * @return DeleteApplicationResponse
 */
async function deleteApplication(request: DeleteApplicationRequest): DeleteApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteApplicationWithOptions(request, runtime);
}

model DeployApplicationRequest {
  applicationId?: string(name='ApplicationId', description='The ID of the application.

This parameter is required.', example='VVK605ZH00OA4MRT'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='1600765710019'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmyjt3c5om3hi'),
}

model DeployApplicationResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  data?: long(name='Data', description='The data of the application.', example='123'),
  message?: string(name='Message', description='The error message.', example='Success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model DeployApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeployApplicationResponseBody(name='body'),
}

/**
 * @summary Deploys an application after the payment.
 *
 * @param request DeployApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeployApplicationResponse
 */
async function deployApplicationWithOptions(request: DeployApplicationRequest, runtime: Util.RuntimeOptions): DeployApplicationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationId)) {
    query['ApplicationId'] = request.applicationId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeployApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deploys an application after the payment.
 *
 * @param request DeployApplicationRequest
 * @return DeployApplicationResponse
 */
async function deployApplication(request: DeployApplicationRequest): DeployApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return deployApplicationWithOptions(request, runtime);
}

model ExecuteOperationASyncRequest {
  applicationId?: string(name='ApplicationId', description='The ID of the Cloud Architect Design Tools (CADT) application.', example='BG**********UQ'),
  attributes?: map[string]any(name='Attributes', description='The parameters related to the action. Specify the parameters based on the value of Operation. The parameters are passed in the map format. The following examples show how to specify the parameters if you want to change the specifications of an Elastic Compute Service (ECS) instance:

*   The following common parameters are required: change_type, regionId, instanceId, appId
*   Example values for changing the instance type of the ECS instance: { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{"change_type":"modify_instance_type","instance_type":"ecs.hfr7.2xlarge","instanceId":"i-xxxxxxxxx","regionId":"cn-beijing","appId":"xxxxxxxxxxxxx"}" }
*   Example values for stopping the ECS instance: { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{"change_type":"modify_status","status":"Stopped","instanceId":"i-xxxxxxxxx","regionId":"cn-beijing","appId":"xxxxxxxxxxxxx"}" }
*   Example values for starting the ECS instance: { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{"change_type":"modify_status","status":"Running","instanceId":"i-xxxxxxxxx","regionId":"cn-beijing","appId":"xxxxxxxxxxxxx"}" }
*   Example values for restarting the ECS instance: { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{"change_type":"modify_status","status":"Restart","instanceId":"i-xxxxxxxxx","regionId":"cn-beijing","appId":"xxxxxxxxxxxxx"}" }

Example of enumerating more than one set of parameters:

*   { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{\\\\\\\\"change_type\\\\\\\\":\\\\\\\\"modify_instance_type\\\\\\\\",\\\\\\\\"instance_type\\\\\\\\":\\\\\\\\"ecs.hfr7.2xlarge\\\\\\\\",\\\\\\\\"instanceId\\\\\\\\":\\\\\\\\"i-xxxxxxxxx\\\\\\\\",\\\\\\\\"regionId\\\\\\\\":\\\\\\\\"cn-beijing\\\\\\\\",\\\\\\\\"appId\\\\\\\\":\\\\\\\\"xxxxxxxxxxxxx\\\\\\\\"}" }

    <!-- -->

    :

    <!-- -->

    { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{\\\\\\\\"change_type\\\\\\\\":\\\\\\\\"modify_instance_type\\\\\\\\",\\\\\\\\"instance_type\\\\\\\\":\\\\\\\\"ecs.hfr7.2xlarge\\\\\\\\",\\\\\\\\"instanceId\\\\\\\\":\\\\\\\\"i-xxxxxxxxx\\\\\\\\",\\\\\\\\"regionId\\\\\\\\":\\\\\\\\"cn-beijing\\\\\\\\",\\\\\\\\"appId\\\\\\\\":\\\\\\\\"xxxxxxxxxxxxx\\\\\\\\"}" }

    <!-- -->'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='1600765710019'),
  operation?: string(name='Operation', description='This operation type is the operation type of modifying the product, some operation types are generic, and some are used alone. The following is an example of ECS deployment:
- The name of the ECS: rename
- Specification of ecs: modifyInstanceType
- Startup of ecs: modifyInstanceType
- Stop of ecs: modifyInstanceType
- Restart of ecs: modifyInstanceType
- Ecs Tag: addTags
- Deletion of ecs: ecsDelete
- Paid type for ecs: modifyPayType

This parameter is required.', example='queryTopo'),
  resourceGroupId?: string(name='ResourceGroupId', description='Resource group ID, which is used to verify the permissions of the resource group', example='ceshi'),
  serviceType?: string(name='ServiceType', description='The type of the service. If you want to perform operations on an Elastic Compute Service (ECS) instance, set ServiceType to ecs.

This parameter is required.', example='ACK'),
}

model ExecuteOperationASyncShrinkRequest {
  applicationId?: string(name='ApplicationId', description='The ID of the Cloud Architect Design Tools (CADT) application.', example='BG**********UQ'),
  attributesShrink?: string(name='Attributes', description='The parameters related to the action. Specify the parameters based on the value of Operation. The parameters are passed in the map format. The following examples show how to specify the parameters if you want to change the specifications of an Elastic Compute Service (ECS) instance:

*   The following common parameters are required: change_type, regionId, instanceId, appId
*   Example values for changing the instance type of the ECS instance: { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{"change_type":"modify_instance_type","instance_type":"ecs.hfr7.2xlarge","instanceId":"i-xxxxxxxxx","regionId":"cn-beijing","appId":"xxxxxxxxxxxxx"}" }
*   Example values for stopping the ECS instance: { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{"change_type":"modify_status","status":"Stopped","instanceId":"i-xxxxxxxxx","regionId":"cn-beijing","appId":"xxxxxxxxxxxxx"}" }
*   Example values for starting the ECS instance: { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{"change_type":"modify_status","status":"Running","instanceId":"i-xxxxxxxxx","regionId":"cn-beijing","appId":"xxxxxxxxxxxxx"}" }
*   Example values for restarting the ECS instance: { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{"change_type":"modify_status","status":"Restart","instanceId":"i-xxxxxxxxx","regionId":"cn-beijing","appId":"xxxxxxxxxxxxx"}" }

Example of enumerating more than one set of parameters:

*   { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{\\\\\\\\"change_type\\\\\\\\":\\\\\\\\"modify_instance_type\\\\\\\\",\\\\\\\\"instance_type\\\\\\\\":\\\\\\\\"ecs.hfr7.2xlarge\\\\\\\\",\\\\\\\\"instanceId\\\\\\\\":\\\\\\\\"i-xxxxxxxxx\\\\\\\\",\\\\\\\\"regionId\\\\\\\\":\\\\\\\\"cn-beijing\\\\\\\\",\\\\\\\\"appId\\\\\\\\":\\\\\\\\"xxxxxxxxxxxxx\\\\\\\\"}" }

    <!-- -->

    :

    <!-- -->

    { "ServiceType": "ecs", "Operation": "modifyInstanceType", "Attributes": "{\\\\\\\\"change_type\\\\\\\\":\\\\\\\\"modify_instance_type\\\\\\\\",\\\\\\\\"instance_type\\\\\\\\":\\\\\\\\"ecs.hfr7.2xlarge\\\\\\\\",\\\\\\\\"instanceId\\\\\\\\":\\\\\\\\"i-xxxxxxxxx\\\\\\\\",\\\\\\\\"regionId\\\\\\\\":\\\\\\\\"cn-beijing\\\\\\\\",\\\\\\\\"appId\\\\\\\\":\\\\\\\\"xxxxxxxxxxxxx\\\\\\\\"}" }

    <!-- -->'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='1600765710019'),
  operation?: string(name='Operation', description='This operation type is the operation type of modifying the product, some operation types are generic, and some are used alone. The following is an example of ECS deployment:
- The name of the ECS: rename
- Specification of ecs: modifyInstanceType
- Startup of ecs: modifyInstanceType
- Stop of ecs: modifyInstanceType
- Restart of ecs: modifyInstanceType
- Ecs Tag: addTags
- Deletion of ecs: ecsDelete
- Paid type for ecs: modifyPayType

This parameter is required.', example='queryTopo'),
  resourceGroupId?: string(name='ResourceGroupId', description='Resource group ID, which is used to verify the permissions of the resource group', example='ceshi'),
  serviceType?: string(name='ServiceType', description='The type of the service. If you want to perform operations on an Elastic Compute Service (ECS) instance, set ServiceType to ecs.

This parameter is required.', example='ACK'),
}

model ExecuteOperationASyncResponseBody = {
  code?: int32(name='Code', description='Result code, 200 for success; Other representatives fail.', example='200'),
  data?: string(name='Data', description='The operation ID. You can call the GetExecuteOperationResult operation to asynchronously query the result of an operation. The ID expires after one hour.', example='op_xxxxxxxxxxxxxxxxxx_ecs_modifyInstanceType_BYSOQGWUV6PME412_ERMEZLXNN3K9N3OL'),
  message?: string(name='Message', description='Error message', example='" "'),
  requestId?: string(name='RequestId', description='Request ID', example='SD-WEF-DSW-32ED-323DDSD-2332D'),
}

model ExecuteOperationASyncResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExecuteOperationASyncResponseBody(name='body'),
}

/**
 * @summary Asynchronous execution of product operation functions.
 *
 * @param tmpReq ExecuteOperationASyncRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExecuteOperationASyncResponse
 */
async function executeOperationASyncWithOptions(tmpReq: ExecuteOperationASyncRequest, runtime: Util.RuntimeOptions): ExecuteOperationASyncResponse {
  Util.validateModel(tmpReq);
  var request = new ExecuteOperationASyncShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.attributes)) {
    request.attributesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.attributes, 'Attributes', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.attributesShrink)) {
    body['Attributes'] = request.attributesShrink;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.operation)) {
    body['Operation'] = request.operation;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.serviceType)) {
    body['ServiceType'] = request.serviceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ExecuteOperationASync',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Asynchronous execution of product operation functions.
 *
 * @param request ExecuteOperationASyncRequest
 * @return ExecuteOperationASyncResponse
 */
async function executeOperationASync(request: ExecuteOperationASyncRequest): ExecuteOperationASyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return executeOperationASyncWithOptions(request, runtime);
}

model ExecuteOperationSyncRequest {
  applicationId?: string(name='ApplicationId', example='BE68D71ZY5YYIU9R'),
  attributes?: map[string]any(name='Attributes'),
  clientToken?: string(name='ClientToken', example='1600765710019'),
  operation?: string(name='Operation', description='This parameter is required.', example='rename'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfmyjt3c5om3hi'),
  serviceType?: string(name='ServiceType', description='This parameter is required.', example='dds'),
}

model ExecuteOperationSyncShrinkRequest {
  applicationId?: string(name='ApplicationId', example='BE68D71ZY5YYIU9R'),
  attributesShrink?: string(name='Attributes'),
  clientToken?: string(name='ClientToken', example='1600765710019'),
  operation?: string(name='Operation', description='This parameter is required.', example='rename'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-acfmyjt3c5om3hi'),
  serviceType?: string(name='ServiceType', description='This parameter is required.', example='dds'),
}

model ExecuteOperationSyncResponseBody = {
  code?: int32(name='Code', example='200'),
  data?: {
    arguments?: string(name='Arguments'),
    message?: string(name='Message'),
    operationId?: string(name='OperationId'),
    status?: string(name='Status'),
  }(name='Data', example='op_xxxxxxxxxxxxxxxxxx_dds_modifyInstanceType_BYSOQGWUV6PME412_ERMEZLXNN3K9N3OL'),
  message?: string(name='Message', example='Access key ID cannot be null.'),
  requestId?: string(name='RequestId', example='FDC73B05-5331-57AA-BA93-4C9882792FF5'),
}

model ExecuteOperationSyncResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExecuteOperationSyncResponseBody(name='body'),
}

/**
 * @summary 维护应用下资源API（同步操作）
 *
 * @param tmpReq ExecuteOperationSyncRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExecuteOperationSyncResponse
 */
async function executeOperationSyncWithOptions(tmpReq: ExecuteOperationSyncRequest, runtime: Util.RuntimeOptions): ExecuteOperationSyncResponse {
  Util.validateModel(tmpReq);
  var request = new ExecuteOperationSyncShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.attributes)) {
    request.attributesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.attributes, 'Attributes', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.attributesShrink)) {
    body['Attributes'] = request.attributesShrink;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.operation)) {
    body['Operation'] = request.operation;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.serviceType)) {
    body['ServiceType'] = request.serviceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ExecuteOperationSync',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 维护应用下资源API（同步操作）
 *
 * @param request ExecuteOperationSyncRequest
 * @return ExecuteOperationSyncResponse
 */
async function executeOperationSync(request: ExecuteOperationSyncRequest): ExecuteOperationSyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return executeOperationSyncWithOptions(request, runtime);
}

model GetApplicationRequest {
  applicationId?: string(name='ApplicationId', description='The ID of the request.

This parameter is required.', example='VVK605ZH00OA4MRT'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmyjt3c5om3hi'),
}

model GetApplicationResponseBody = {
  code?: string(name='Code', description='The response code.', example='200'),
  data?: {
    applicationId?: string(name='ApplicationId', description='App ID', example='VVK605ZH00OA4MRT'),
    checklist?: [ 
      {
        lifecycle?: string(name='Lifecycle', description='The resource tag.', example='Create'),
        region?: string(name='Region', description='The region in which the instance resides.', example='cn-hangzhou'),
        remark?: string(name='Remark', description='The message returned for verification.', example='The ID of the region.'),
        resourceCode?: string(name='ResourceCode', description='The service code.', example='vpc'),
        resourceName?: string(name='ResourceName', description='The name of the instance.', example='vpc'),
        result?: string(name='Result', description='The verification result.', example='Finish'),
        specification?: string(name='Specification', description='The resource specifications.', example='192.168.0.0/16'),
      }
    ](name='Checklist', description='The resource tag.'),
    complianceList?: [ 
      {
        resourceCode?: string(name='ResourceCode'),
        resourceName?: string(name='ResourceName'),
        rules?: [ 
          {
            ruleDetail?: string(name='ruleDetail'),
            ruleId?: string(name='ruleId'),
          }
        ](name='Rules'),
      }
    ](name='ComplianceList'),
    createTime?: string(name='CreateTime', description='The time when the app was created', example='2021-08-09 14:37:16'),
    deployPercent?: double(name='DeployPercent'),
    description?: string(name='Description', description='Application description', example='remark'),
    error?: string(name='Error', description='The resource type.', example='Success'),
    imageURL?: string(name='ImageURL', description='The URL of the image in the database.', example='The details of the application.'),
    name?: string(name='Name', description='App name', example='1411182597819805/sr-8DWU4RUS49NIDII0.png'),
    priceList?: [ 
      {
        chargeType?: string(name='ChargeType', description='The billing method.', example='PayAsYouGo'),
        count?: int32(name='Count', description='The quantity.', example='1'),
        instanceName?: string(name='InstanceName', description='The name of the instance.', example='ecs'),
        lifecycle?: string(name='Lifecycle', description='Resource Fill Labels.', example='Create'),
        onePrice?: double(name='OnePrice', description='The unit price of the instance.', example='0.01'),
        originalPrice?: double(name='OriginalPrice', description='The original price of the instance.', example='3.570'),
        period?: int32(name='Period', description='The service duration.', example='1'),
        price?: double(name='Price', description='The total price.', example='0.01'),
        priceUnit?: string(name='PriceUnit', description='Unit: USD per hour', example='The service duration.'),
        region?: string(name='Region', description='The region in which the instance resides.', example='cn-hangzhou'),
        remark?: string(name='Remark', description='The error message that is returned when a price query fails.', example='ecs.e3.large'),
        resourceCode?: string(name='ResourceCode', description='Product code', example='ecs'),
        specification?: string(name='Specification', description='The instance type. This parameter indicates the information about the instance type. For example, 192.168.0.0/16 may be returned for a Virtual Private Cloud (VPC) instance, ecs.g5.large may be returned for an Elastic Compute Service (ECS) instance, and slb.s1.small may be returned for a Server Load Balancer (SLB) instance. If the resource does not have a specific type, an empty value is returned.', example='The billing method.'),
        type?: string(name='type', description='The creation mode. Valid values:\\\\
1: creates a new instance.\\\\
2: imports an instance.', example='1'),
      }
    ](name='PriceList', description='The billing results.'),
    resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the app belongs', example='rg-aekzhfgmw4e6fwq'),
    resourceList?: [ 
      {
        chargeType?: string(name='ChargeType', description='The billing method.', example='PayAsYouGo'),
        lifecycle?: string(name='Lifecycle', description='The resource tag.', example='Create'),
        nodeLabel?: string(name='NodeLabel'),
        remark?: string(name='Remark', description='The deployment result.', example='{"hostName":"iZ2zehnzxqixu1pywsfbx1Z","memory":32768.0,"creationTime":"2021-09-28T11:23:46Z","instanceName":"ecs","internetMaxBandwidthOut":0.0,"description":"","clusterId":"","private_ip":"192.168.0.247","instanceId":"i-2zehnzxqixu1pywsfbx1","requestId":"F1C64344-3723-51A0-855B-5F08B5634323","zoneId":"cn-beijing-b","ioOptimized":"optimized","id":"i-2zehnzxqixu1pywsfbx1","instanceNetworkType":"vpc","instanceChargeType":"PostPaid","imageId":"centos_8_4_x64_20G_alibase_20210824.vhd","serialNumber":"cee246c4-38f3-4bf3-950b-c17e88ff6527","vlanId":"","instanceType":"ecs.e3.large","cpu":4.0,"creditSpecification":"","internetMaxBandwidthIn":-1.0,"expiredTime":"2099-12-31T15:59Z","internetChargeType":"PayByTraffic","regionId":"cn-beijing","refId":"79224644_0","stoppedMode":"Not-applicable","status":"Running"}'),
        resourceCode?: string(name='ResourceCode', description='The service code.', example='ecs'),
        resourceId?: string(name='ResourceId', description='The instance ID.', example='i-2zehnzxqixu1pywsfbx1'),
        resourceName?: string(name='ResourceName', description='The name of the instance.', example='ecs'),
        resourceType?: string(name='ResourceType', description='The type of the resource.', example='ecs'),
        status?: string(name='Status', description='The resource deployment result.', example='Finish'),
      }
    ](name='ResourceList', description='The resource specification.'),
    status?: string(name='Status', description='Verification passed', example='Deployed_Success'),
    templateId?: string(name='TemplateId', description='The ID of the template associated with the application', example='FYS9VZ535U20V7HT'),
  }(name='Data', description='The details of the application.'),
  message?: string(name='Message', description='Reason for the request failure', example='Success'),
  requestId?: string(name='RequestId', description='Request ID', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model GetApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetApplicationResponseBody(name='body'),
}

/**
 * @summary The URL of the application topology image.
 *
 * @param request GetApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetApplicationResponse
 */
async function getApplicationWithOptions(request: GetApplicationRequest, runtime: Util.RuntimeOptions): GetApplicationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary The URL of the application topology image.
 *
 * @param request GetApplicationRequest
 * @return GetApplicationResponse
 */
async function getApplication(request: GetApplicationRequest): GetApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return getApplicationWithOptions(request, runtime);
}

model GetApplicationVariablesRequest {
  appId?: string(name='AppId', example='Q2P4O9YSOKCQ35L9'),
}

model GetApplicationVariablesResponseBody = {
  code?: int32(name='Code', example='200'),
  data?: [ 
    {
      instanceId?: string(name='InstanceId', example='ob5epf79uv****'),
      variableList?: [ 
        {
          value?: string(name='Value', example='ecs.c6.4xlarge'),
          variable?: string(name='Variable', example='${instance_type}'),
        }
      ](name='VariableList'),
    }
  ](name='Data'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', description='Id of the request', example='7036DDBE-0ABA-52D7-A39D-75E511970F07'),
}

model GetApplicationVariablesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetApplicationVariablesResponseBody(name='body'),
}

/**
 * @summary 获取应用输入参数
 *
 * @param request GetApplicationVariablesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetApplicationVariablesResponse
 */
async function getApplicationVariablesWithOptions(request: GetApplicationVariablesRequest, runtime: Util.RuntimeOptions): GetApplicationVariablesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetApplicationVariables',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取应用输入参数
 *
 * @param request GetApplicationVariablesRequest
 * @return GetApplicationVariablesResponse
 */
async function getApplicationVariables(request: GetApplicationVariablesRequest): GetApplicationVariablesResponse {
  var runtime = new Util.RuntimeOptions{};
  return getApplicationVariablesWithOptions(request, runtime);
}

model GetApplicationVariables4FailRequest {
  appId?: string(name='AppId', example='Q2P4O9YSOKCT35L9'),
}

model GetApplicationVariables4FailResponseBody = {
  code?: int32(name='Code', example='200'),
  data?: [ 
    {
      attribute?: string(name='Attribute', example='instance_name'),
      defaultValue?: string(name='DefaultValue', example='cadt-app-01'),
      placeHolder?: string(name='PlaceHolder', example='${name}'),
      region?: string(name='Region', example='cn-shenzhen'),
      value?: string(name='Value', example='cadt-app-01'),
      variable?: string(name='Variable', example='${name}'),
    }
  ](name='Data'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', description='Id of the request', example='BFB7F5C8-FE7A-06CA-9F87-ABBF6B848F0C'),
}

model GetApplicationVariables4FailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetApplicationVariables4FailResponseBody(name='body'),
}

/**
 * @summary 获取需要重新配置的变量列表
 *
 * @param request GetApplicationVariables4FailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetApplicationVariables4FailResponse
 */
async function getApplicationVariables4FailWithOptions(request: GetApplicationVariables4FailRequest, runtime: Util.RuntimeOptions): GetApplicationVariables4FailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetApplicationVariables4Fail',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取需要重新配置的变量列表
 *
 * @param request GetApplicationVariables4FailRequest
 * @return GetApplicationVariables4FailResponse
 */
async function getApplicationVariables4Fail(request: GetApplicationVariables4FailRequest): GetApplicationVariables4FailResponse {
  var runtime = new Util.RuntimeOptions{};
  return getApplicationVariables4FailWithOptions(request, runtime);
}

model GetExecuteOperationResultRequest {
  operationId?: string(name='OperationId', description='The ID of the operation.

This parameter is required.', example='op_xxxxxxxxxxxxxxxxxxxxxx'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group. This parameter is specified to verify the permissions on the resource group.', example='testResourceId'),
}

model GetExecuteOperationResultResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. A value of 200 indicates that the request is successful.', example='200'),
  data?: {
    arguments?: string(name='Arguments', description='The output of the operation.', example='" "'),
    message?: string(name='Message', description='The returned message.', example='“ ”'),
    operationId?: string(name='OperationId', description='The ID of the operation.', example='op_xxxxxxxx'),
    status?: string(name='Status', description='The status of the operation.', example='success'),
  }(name='Data', description='The detailed result of the queried operation.'),
  message?: string(name='Message', description='The error message.', example='" "'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
}

model GetExecuteOperationResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetExecuteOperationResultResponseBody(name='body'),
}

/**
 * @summary Asynchronously queries the result of an operation that is performed on a service instance.
 *
 * @param request GetExecuteOperationResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetExecuteOperationResultResponse
 */
async function getExecuteOperationResultWithOptions(request: GetExecuteOperationResultRequest, runtime: Util.RuntimeOptions): GetExecuteOperationResultResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.operationId)) {
    body['OperationId'] = request.operationId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetExecuteOperationResult',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Asynchronously queries the result of an operation that is performed on a service instance.
 *
 * @param request GetExecuteOperationResultRequest
 * @return GetExecuteOperationResultResponse
 */
async function getExecuteOperationResult(request: GetExecuteOperationResultRequest): GetExecuteOperationResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getExecuteOperationResultWithOptions(request, runtime);
}

model GetFoTaskStatusRequest {
  taskId?: int32(name='TaskId', description='The disaster recovery switchover task ID.', example='2615'),
}

model GetFoTaskStatusResponseBody = {
  code?: string(name='Code', description='The response code.', example='200'),
  data?: string(name='Data', description='The status of the switchover task.', example='Running'),
  message?: string(name='Message', description='The returned message. If the request was successful, a success message is returned. If the request failed, an error message is returned.', example='OKITHEVRQCN6ULQG'),
  requestId?: string(name='RequestId', description='The request ID.', example='923692F0-A15B-58B4-BAF4-2AFA4AF46240'),
}

model GetFoTaskStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFoTaskStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status of a disaster recovery switchover task by task ID.
 *
 * @description You can call this operation to query the status of a disaster recovery switchover task by task ID.
 *
 * @param request GetFoTaskStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFoTaskStatusResponse
 */
async function getFoTaskStatusWithOptions(request: GetFoTaskStatusRequest, runtime: Util.RuntimeOptions): GetFoTaskStatusResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFoTaskStatus',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the status of a disaster recovery switchover task by task ID.
 *
 * @description You can call this operation to query the status of a disaster recovery switchover task by task ID.
 *
 * @param request GetFoTaskStatusRequest
 * @return GetFoTaskStatusResponse
 */
async function getFoTaskStatus(request: GetFoTaskStatusRequest): GetFoTaskStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFoTaskStatusWithOptions(request, runtime);
}

model GetPotentialFailZonesRequest {
  isPlanId?: boolean(name='IsPlanId', description='Specifies whether the value of this parameter is the ID of a disaster recovery set.', example='true'),
  objectId?: string(name='ObjectId', description='If you set IsPlanId to false, specify the ID of a disaster recovery application. If you set IsPlanId to true, specify the ID of a disaster recovery set.', example='FS3ATPTOSC4SE1GG'),
}

model GetPotentialFailZonesResponseBody = {
  code?: string(name='Code', description='The response code.', example='200'),
  data?: [ string ](name='Data', description='The zones where the current disaster recovery service can be switched.'),
  message?: string(name='Message', description='The error message.', example='The specified ResourceIds are not found in our records.'),
  requestId?: string(name='RequestId', description='The request ID.', example='BFB7F5C8-FE7A-06CA-9F87-ABBF6B848F0C'),
}

model GetPotentialFailZonesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPotentialFailZonesResponseBody(name='body'),
}

/**
 * @summary Queries the zones where the specified disaster recovery service can be switched.
 *
 * @description You can call this operation to query the zones where the specified disaster recovery service can be switched.
 *
 * @param request GetPotentialFailZonesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPotentialFailZonesResponse
 */
async function getPotentialFailZonesWithOptions(request: GetPotentialFailZonesRequest, runtime: Util.RuntimeOptions): GetPotentialFailZonesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.isPlanId)) {
    body['IsPlanId'] = request.isPlanId;
  }
  if (!Util.isUnset(request.objectId)) {
    body['ObjectId'] = request.objectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetPotentialFailZones',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the zones where the specified disaster recovery service can be switched.
 *
 * @description You can call this operation to query the zones where the specified disaster recovery service can be switched.
 *
 * @param request GetPotentialFailZonesRequest
 * @return GetPotentialFailZonesResponse
 */
async function getPotentialFailZones(request: GetPotentialFailZonesRequest): GetPotentialFailZonesResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPotentialFailZonesWithOptions(request, runtime);
}

model GetResource4ModifyRecordRequest {
  applicationId?: string(name='ApplicationId', description='This parameter is required.', example='BE68D71ZY5YYIU9R'),
  maxResults?: long(name='MaxResults', example='10'),
  nextToken?: long(name='NextToken', example='1'),
}

model GetResource4ModifyRecordResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{
    "PolicyType": "",
    "AuthPrincipalOwnerId": "",
    "EncodedDiagnosticMessage": "",
    "AuthPrincipalType": "",
    "AuthPrincipalDisplayName": "",
    "NoPermissionType": "",
    "AuthAction": ""
  }'),
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      attribute?: string(name='Attribute', example='{\\\\"InstanceId\\\\": \\\\"\\\\", \\\\"AttributeName\\\\": \\\\"drmCommand\\\\", \\\\"Id\\\\": 16800, \\\\"Desc\\\\": \\\\"test\\\\"}'),
      error?: string(name='Error'),
      modifyTime?: string(name='ModifyTime', example='1726645341000'),
      resourceId?: string(name='ResourceId', example='rm-uf6308dyal1*****'),
      status?: string(name='Status', example='Finish'),
      type?: string(name='Type', example='rds'),
    }
  ](name='Data'),
  message?: string(name='Message', example='Success'),
  nextToken?: string(name='NextToken', example='2'),
  requestId?: string(name='RequestId', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
  totalCount?: string(name='TotalCount', example='123'),
}

model GetResource4ModifyRecordResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResource4ModifyRecordResponseBody(name='body'),
}

/**
 * @summary 获取询价应用变配记录
 *
 * @param request GetResource4ModifyRecordRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResource4ModifyRecordResponse
 */
async function getResource4ModifyRecordWithOptions(request: GetResource4ModifyRecordRequest, runtime: Util.RuntimeOptions): GetResource4ModifyRecordResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.maxResults)) {
    body['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    body['NextToken'] = request.nextToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetResource4ModifyRecord',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取询价应用变配记录
 *
 * @param request GetResource4ModifyRecordRequest
 * @return GetResource4ModifyRecordResponse
 */
async function getResource4ModifyRecord(request: GetResource4ModifyRecordRequest): GetResource4ModifyRecordResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResource4ModifyRecordWithOptions(request, runtime);
}

model GetResult4QueryInstancePrice4ModifyRequest {
  applicationId?: string(name='ApplicationId', example='02S7UU41WKJL7ERR'),
  taskId?: string(name='TaskId', description='This parameter is required.', example='58d5d8c5b5489150417a7cd6caa614bb'),
}

model GetResult4QueryInstancePrice4ModifyResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{
    "PolicyType": "",
    "AuthPrincipalOwnerId": "",
    "EncodedDiagnosticMessage": "",
    "AuthPrincipalType": "",
    "AuthPrincipalDisplayName": "",
    "NoPermissionType": "",
    "AuthAction": ""
  }'),
  code?: string(name='Code', example='200'),
  data?: {
    priceList?: [ 
      {
        discountAmount?: double(name='DiscountAmount', example='2'),
        error?: string(name='Error'),
        nodeType?: string(name='NodeType', example='vpc'),
        originalAmount?: double(name='OriginalAmount', example='3'),
        priceUnit?: string(name='PriceUnit'),
        promotionName?: string(name='PromotionName'),
        tradeAmount?: double(name='TradeAmount', example='1'),
      }
    ](name='PriceList'),
    status?: string(name='Status', example='SUCCESS'),
    taskId?: string(name='TaskId', example='d9a3e99b-6954-4a16-ad51-954db4a528b7'),
  }(name='Data'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model GetResult4QueryInstancePrice4ModifyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResult4QueryInstancePrice4ModifyResponseBody(name='body'),
}

/**
 * @summary 获取询价结果
 *
 * @param request GetResult4QueryInstancePrice4ModifyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResult4QueryInstancePrice4ModifyResponse
 */
async function getResult4QueryInstancePrice4ModifyWithOptions(request: GetResult4QueryInstancePrice4ModifyRequest, runtime: Util.RuntimeOptions): GetResult4QueryInstancePrice4ModifyResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetResult4QueryInstancePrice4Modify',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取询价结果
 *
 * @param request GetResult4QueryInstancePrice4ModifyRequest
 * @return GetResult4QueryInstancePrice4ModifyResponse
 */
async function getResult4QueryInstancePrice4Modify(request: GetResult4QueryInstancePrice4ModifyRequest): GetResult4QueryInstancePrice4ModifyResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResult4QueryInstancePrice4ModifyWithOptions(request, runtime);
}

model GetTemplateRequest {
  region?: string(name='Region', description='Template Area', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='ResourceGroup ID', example='rg-aekzhfgmw4e6fwq'),
  templateId?: string(name='TemplateId', description='Template ID

This parameter is required.', example='XFKR6WYRVS24S07R'),
}

model GetTemplateResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  data?: {
    createTime?: string(name='CreateTime', description='The time when the template was created.', example='2020-09-22 17:08:31'),
    description?: string(name='Description', description='Template Description', example='remark'),
    imageURL?: string(name='ImageURL', description='The path to the template schema image file', example='bp-studio-template/sr-U37UD2YQCRJ75X5V.png'),
    name?: string(name='Name', description='The name of the template', example='cadt-template'),
    resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-aekzhfgmw4e6fwq'),
    templateId?: string(name='TemplateId', description='Template ID', example='XFKR6WYRVS24S07R'),
    variables?: [ 
      {
        attribute?: string(name='Attribute', description='The name of the variable.', example='instance_name'),
        dataType?: string(name='DataType', description='The type of the variable.', example='String'),
        defaultValue?: string(name='DefaultValue', description='The default value of the variable.', example='cadt-app-01'),
        options?: string(name='Options'),
        variable?: string(name='Variable', description='The value of the variable.', example='${name}'),
      }
    ](name='Variables', description='The details of the template variables.'),
  }(name='Data', description='The details of the template.'),
  message?: string(name='Message', description='The interface returns information', example='Success'),
  requestId?: string(name='RequestId', description='Request ID', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model GetTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTemplateResponseBody(name='body'),
}

/**
 * @summary Gets template images and information about architecture diagrams.
 *
 * @param request GetTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTemplateResponse
 */
async function getTemplateWithOptions(request: GetTemplateRequest, runtime: Util.RuntimeOptions): GetTemplateResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetTemplate',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Gets template images and information about architecture diagrams.
 *
 * @param request GetTemplateRequest
 * @return GetTemplateResponse
 */
async function getTemplate(request: GetTemplateRequest): GetTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTemplateWithOptions(request, runtime);
}

model GetTokenRequest {
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-aekzhfgmw4e6fwq'),
}

model GetTokenResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  data?: {
    accessKeyId?: string(name='AccessKeyId', description='The AccessKey ID that is used to access OSS.', example='STS.NTm*****8tu'),
    accessKeySecret?: string(name='AccessKeySecret', description='The AccessKey secret used to access OSS.', example='9NG*****K4X'),
    bucket?: string(name='Bucket', description='The OSS bucket that is used to store the architecture image.', example='bucket-1'),
    endpoint?: string(name='Endpoint', description='The OSS endpoint.', example='https://oss-cn-beijing.aliyuncs.com'),
    securityToken?: string(name='SecurityToken', description='The token that is used to access the Object Storage Service (OSS) bucket that stores the architecture image.', example='ABCD'),
    snapshotBucket?: string(name='SnapshotBucket', description='The OSS bucket that is used to save data snapshots.', example='bucket-2'),
  }(name='Data', description='The information about the token.'),
  message?: string(name='Message', description='The returned message.', example='Success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model GetTokenResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTokenResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI GetToken is deprecated, please use BPStudio::2021-09-31::GetApplication instead.
 *
 * @summary Obtains a temporary token that is used to read the architecture diagram. The validity period of the token is 30 minutes.
 *
 * @description >Danger:  This API is no longer recommended, and the image related to the Application has included access authorization in the GetApplication property.
 *
 * @param request GetTokenRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTokenResponse
 */
// Deprecated
async function getTokenWithOptions(request: GetTokenRequest, runtime: Util.RuntimeOptions): GetTokenResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetToken',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @deprecated OpenAPI GetToken is deprecated, please use BPStudio::2021-09-31::GetApplication instead.
 *
 * @summary Obtains a temporary token that is used to read the architecture diagram. The validity period of the token is 30 minutes.
 *
 * @description >Danger:  This API is no longer recommended, and the image related to the Application has included access authorization in the GetApplication property.
 *
 * @param request GetTokenRequest
 * @return GetTokenResponse
 */
// Deprecated
async function getToken(request: GetTokenRequest): GetTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTokenWithOptions(request, runtime);
}

model InitAppFailOverRequest {
  applicationId?: string(name='ApplicationId', description='The application ID.', example='002XWH7MXB8MJRU0'),
}

model InitAppFailOverResponseBody = {
  code?: string(name='Code', description='The response code.', example='200'),
  data?: int32(name='Data', description='The switchover task ID.', example='7250'),
  message?: string(name='Message', description='The returned message. If the request was successful, a success message is returned. If the request failed, an error message is returned.', example='Unsupported Operation PrepareEvent->FailOverPrepareSuccess FoApp_DDLJK2WM8ETU9JAC'),
  requestId?: string(name='RequestId', description='The request ID.', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model InitAppFailOverResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InitAppFailOverResponseBody(name='body'),
}

/**
 * @summary Prepares for application switchover and initiates a switchover task.
 *
 * @description You can call this operation to prepare for application switchover and initiate a switchover task.
 *
 * @param request InitAppFailOverRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return InitAppFailOverResponse
 */
async function initAppFailOverWithOptions(request: InitAppFailOverRequest, runtime: Util.RuntimeOptions): InitAppFailOverResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'InitAppFailOver',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Prepares for application switchover and initiates a switchover task.
 *
 * @description You can call this operation to prepare for application switchover and initiate a switchover task.
 *
 * @param request InitAppFailOverRequest
 * @return InitAppFailOverResponse
 */
async function initAppFailOver(request: InitAppFailOverRequest): InitAppFailOverResponse {
  var runtime = new Util.RuntimeOptions{};
  return initAppFailOverWithOptions(request, runtime);
}

model ListApplicationRequest {
  keyword?: string(name='Keyword', description='Keywords in the app name', example='test'),
  maxResults?: int32(name='MaxResults', description='The pagination size of the resulting value cannot be less than the minimum value of 1 and cannot be greater than the maximum value of 50.

This parameter is required.', example='10'),
  nextToken?: int32(name='NextToken', description='The pagination page number of the resulting value cannot be less than the minimum value of 1 and cannot be greater than the maximum value of 10000.

This parameter is required.', example='1'),
  orderType?: long(name='OrderType', description='1 update time,<br>2 creation time', example='1'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='default'),
  resourceId?: string(name='ResourceId', description='Resource Id', example='vsw-xxxxxxxxxxxx'),
  status?: string(name='Status', description='The status of the applications to be returned.', example='The following values are "success" and "release".
If the input value is "success", the returned application list includes all applications in the Deployed_Success state of successful deployment.
If the input value is release, the returned application list includes all applications in the release success (Destroyed_Success) and release failure (Destroyed_Failure) status.
If this parameter is left blank, the returned app list includes apps in all states.'),
  templateId?: string(name='TemplateId', description='Template Id', example='0KSXXX6SJU03TXXX'),
}

model ListApplicationResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  data?: [ 
    {
      applicationId?: string(name='ApplicationId', description='The application ID.', example='JIX9NEZUALGS46UI'),
      createTime?: string(name='CreateTime', description='The time when the application was created.', example='2021-09-15  08:30:00'),
      imageURL?: string(name='ImageURL', description='The URL of the application architecture image.', example='https://bp-studio-daily.oss-cn-beijing.aliyuncs.com/1411182597819805/sr-Y3KR7ZSQZR2F0YX3.png'),
      name?: string(name='Name', description='The name of the application.', example='cadt-appName'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the application belongs.', example='default'),
      status?: string(name='Status', description='The status of the application.', example='Deployed_Success'),
    }
  ](name='Data', description='App listing information'),
  message?: string(name='Message', description='The interface returns information', example='Success'),
  nextToken?: int32(name='NextToken', description='The query token returned in this call.', example='2'),
  requestId?: string(name='RequestId', description='The ID of the application.', example='BFB7F5C8-FE7A-06CA-9F87-ABBF6B848F0C'),
  totalCount?: int32(name='TotalCount', description='The total number of returned entries.', example='123'),
}

model ListApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListApplicationResponseBody(name='body'),
}

/**
 * @summary This API provides a list of all applications under the current user. The optional keyword parameter defines the keywords contained in the application name.
 *
 * @param request ListApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListApplicationResponse
 */
async function listApplicationWithOptions(request: ListApplicationRequest, runtime: Util.RuntimeOptions): ListApplicationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.keyword)) {
    body['Keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.maxResults)) {
    body['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    body['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.orderType)) {
    body['OrderType'] = request.orderType;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    body['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary This API provides a list of all applications under the current user. The optional keyword parameter defines the keywords contained in the application name.
 *
 * @param request ListApplicationRequest
 * @return ListApplicationResponse
 */
async function listApplication(request: ListApplicationRequest): ListApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return listApplicationWithOptions(request, runtime);
}

model ListFoCreatedAppsResponseBody = {
  code?: string(name='Code', description='The status code.', example='200'),
  data?: [ 
    {
      applicationId?: string(name='ApplicationId', description='The application ID.', example='JIX9NEZUALGS46UI'),
      reportUrl?: string(name='ReportUrl', description='The URL of the error report.', example='https://api.aliyun.com/troubleshoot?q=ServiceUnavailable&product=BPStudio&requestId=4CDA03A3-C652-1408-8ABD-7E652A7CBFB6'),
      status?: string(name='Status', description='The state of the application.', example='Deployed_Success
Destroyed_Success'),
      title?: string(name='Title', description='The title.', example='容灾计划1'),
    }
  ](name='Data', description='The templates.'),
  message?: string(name='Message', description='The returned error message.', example='Cannot find region according to your domain.'),
  requestId?: string(name='RequestId', description='The request ID.', example='40F63F07-3AB6-53B3-8825-0580C130E3EA'),
}

model ListFoCreatedAppsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFoCreatedAppsResponseBody(name='body'),
}

/**
 * @summary Queries the information about all disaster recovery plans of the current account.
 *
 * @description Queries the information about all disaster recovery plans of the current account.
 *
 * @param request ListFoCreatedAppsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFoCreatedAppsResponse
 */
async function listFoCreatedAppsWithOptions(runtime: Util.RuntimeOptions): ListFoCreatedAppsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'ListFoCreatedApps',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about all disaster recovery plans of the current account.
 *
 * @description Queries the information about all disaster recovery plans of the current account.
 *
 * @return ListFoCreatedAppsResponse
 */
async function listFoCreatedApps(): ListFoCreatedAppsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFoCreatedAppsWithOptions(runtime);
}

model ListTagResourcesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='1600765710019'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='1'),
  regionId?: string(name='RegionId', description='The ID of the region.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The resource IDs. You can specify a maximum number of 50 IDs.

This parameter is required.'),
  resourceType?: string(name='ResourceType', description='The resource type.

This parameter is required.', example='Application'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='Label 1'),
      value?: string(name='Value', description='The value of the tag.', example='Label value 1'),
    }
  ](name='Tag', description='The tags. A maximum of 20 tags are supported.'),
}

model ListTagResourcesResponseBody = {
  code?: string(name='Code', description='The HTTP status code. A value of 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The error message returned if the request failed.', example='bp.java.nopowerContact'),
  nextToken?: string(name='NextToken', description='The returned value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results. If the NextToken parameter is empty, no next page exists.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='847C9D0A-BABD-589C-8A9C-6464409EDED9'),
  tagResources?: [ 
    {
      resourceId?: string(name='ResourceId', description='The ID of the resource.', example='MW7T1820ACJX9BI7'),
      resourceType?: string(name='ResourceType', description='The resource type. Valid values: application and template.', example='application'),
      tagKey?: string(name='TagKey', description='The key of the tag.', example='Key'),
      tagValue?: string(name='TagValue', description='The value of the tag.', example='Value'),
    }
  ](name='TagResources', description='The tags that are added to the resources.'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the tags of one or more applications or templates.
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.nextToken)) {
    body['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    body['RegionId'] = request.regionId;
  }
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.resourceId)) {
    bodyFlat['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    body['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    bodyFlat['Tag'] = request.tag;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tags of one or more applications or templates.
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ListTemplateRequest {
  keyword?: string(name='Keyword', description='The keyword that is used to search for templates.', example='cadt'),
  maxResults?: int32(name='MaxResults', description='The number of entries to return on each page.

This parameter is required.', example='10'),
  nextToken?: int32(name='NextToken', description='The number of the page to return.

This parameter is required.', example='1'),
  orderType?: long(name='OrderType', description='The criterion by which the returned templates are sorted. Valid values:

*   1: The templates are sorted by the time when they are updated.
*   2: The templates are sorted by the time when they are created.
*   3: The templates are sorted by the system.
*   4: The templates are sorted by the number of times that they are used.
*   If you specify an integer other than 1, 2, 3, and 4 or do not specify any value, the templates are sorted by the system.', example='1'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmyjt3c5om3hi'),
  tagList?: int32(name='TagList', description='The tag that you want to use to query templates.', example='1'),
  type?: string(name='Type', description='The type of the templates to be returned. Valid values: public and private

This parameter is required.', example='public'),
}

model ListTemplateResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  data?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the template was created.', example='2021-03-18 16:41:31'),
      imageURL?: string(name='ImageURL', description='The URL of the architecture image.', example='bp-studio-template/sr-U37UD2YQCRJ75X5V.png'),
      name?: string(name='Name', description='The name of the template.', example='cadt-name'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmyjt3c5om3hi'),
      tagId?: int32(name='TagId', description='The ID of the tag that is added to the template.', example='1'),
      tagName?: string(name='TagName', description='The name of the tag that is added to the template.', example='Official template'),
      templateId?: string(name='TemplateId', description='The ID of the template.', example='CJQ6H0XUEQ20IYJQ'),
    }
  ](name='Data', description='The details about templates.'),
  message?: string(name='Message', description='The returned message.', example='Success'),
  nextToken?: int32(name='NextToken', description='The page number of the returned page.', example='1'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
  totalCount?: int32(name='TotalCount', description='The total number of returned entries.', example='100'),
}

model ListTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTemplateResponseBody(name='body'),
}

/**
 * @summary Queries templates, including information such as the template name, architecture image URL, and URL of the serialized architecture image file.
 *
 * @param request ListTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTemplateResponse
 */
async function listTemplateWithOptions(request: ListTemplateRequest, runtime: Util.RuntimeOptions): ListTemplateResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.keyword)) {
    body['Keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.maxResults)) {
    body['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    body['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.orderType)) {
    body['OrderType'] = request.orderType;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.tagList)) {
    body['TagList'] = request.tagList;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListTemplate',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries templates, including information such as the template name, architecture image URL, and URL of the serialized architecture image file.
 *
 * @param request ListTemplateRequest
 * @return ListTemplateResponse
 */
async function listTemplate(request: ListTemplateRequest): ListTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTemplateWithOptions(request, runtime);
}

model ModifyApplicationSpecRequest {
  applicationId?: string(name='ApplicationId', description='This parameter is required.', example='02S7UU41WKJL7ERR'),
  instanceSpec?: [ 
    {
      configuration?: map[string]any(name='Configuration'),
      instanceId?: string(name='InstanceId', example='rm-2ze8f4ah378a*****'),
    }
  ](name='InstanceSpec'),
}

model ModifyApplicationSpecShrinkRequest {
  applicationId?: string(name='ApplicationId', description='This parameter is required.', example='02S7UU41WKJL7ERR'),
  instanceSpecShrink?: string(name='InstanceSpec'),
}

model ModifyApplicationSpecResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{
    "PolicyType": "",
    "AuthPrincipalOwnerId": "",
    "EncodedDiagnosticMessage": "",
    "AuthPrincipalType": "",
    "AuthPrincipalDisplayName": "",
    "NoPermissionType": "",
    "AuthAction": ""
  }'),
  code?: string(name='Code', example='200'),
  data?: string(name='Data', example='-1'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='A3488F1D-xxxx-xxxx-xxxx-5374BA0F3562'),
  success?: string(name='Success', example='true'),
}

model ModifyApplicationSpecResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyApplicationSpecResponseBody(name='body'),
}

/**
 * @summary 提交应用变配
 *
 * @param tmpReq ModifyApplicationSpecRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyApplicationSpecResponse
 */
async function modifyApplicationSpecWithOptions(tmpReq: ModifyApplicationSpecRequest, runtime: Util.RuntimeOptions): ModifyApplicationSpecResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyApplicationSpecShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.instanceSpec)) {
    request.instanceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instanceSpec, 'InstanceSpec', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.instanceSpecShrink)) {
    body['InstanceSpec'] = request.instanceSpecShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyApplicationSpec',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 提交应用变配
 *
 * @param request ModifyApplicationSpecRequest
 * @return ModifyApplicationSpecResponse
 */
async function modifyApplicationSpec(request: ModifyApplicationSpecRequest): ModifyApplicationSpecResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyApplicationSpecWithOptions(request, runtime);
}

model QueryInstancePrice4ModifyRequest {
  applicationId?: string(name='ApplicationId', description='This parameter is required.', example='002XWH7MXB8MJRU0'),
  configuration?: map[string]any(name='Configuration'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='rm-uf66k9143r2ch*****'),
}

model QueryInstancePrice4ModifyShrinkRequest {
  applicationId?: string(name='ApplicationId', description='This parameter is required.', example='002XWH7MXB8MJRU0'),
  configurationShrink?: string(name='Configuration'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='rm-uf66k9143r2ch*****'),
}

model QueryInstancePrice4ModifyResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{
    "PolicyType": "",
    "AuthPrincipalOwnerId": "",
    "EncodedDiagnosticMessage": "",
    "AuthPrincipalType": "",
    "AuthPrincipalDisplayName": "",
    "NoPermissionType": "",
    "AuthAction": ""
  }'),
  code?: string(name='Code', example='200'),
  data?: string(name='Data', description='taskId'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='9656C816-1E9A-58D2-86D5-710678D61AF1'),
  success?: string(name='Success', example='true'),
}

model QueryInstancePrice4ModifyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryInstancePrice4ModifyResponseBody(name='body'),
}

/**
 * @summary 查询变配价格
 *
 * @param tmpReq QueryInstancePrice4ModifyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryInstancePrice4ModifyResponse
 */
async function queryInstancePrice4ModifyWithOptions(tmpReq: QueryInstancePrice4ModifyRequest, runtime: Util.RuntimeOptions): QueryInstancePrice4ModifyResponse {
  Util.validateModel(tmpReq);
  var request = new QueryInstancePrice4ModifyShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.configuration)) {
    request.configurationShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.configuration, 'Configuration', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.configurationShrink)) {
    body['Configuration'] = request.configurationShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryInstancePrice4Modify',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询变配价格
 *
 * @param request QueryInstancePrice4ModifyRequest
 * @return QueryInstancePrice4ModifyResponse
 */
async function queryInstancePrice4Modify(request: QueryInstancePrice4ModifyRequest): QueryInstancePrice4ModifyResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryInstancePrice4ModifyWithOptions(request, runtime);
}

model QueryInstanceSpec4ModifyRequest {
  applicationId?: string(name='ApplicationId', description='This parameter is required.', example='BE68D71ZY5YYIU9R'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='rm-uf66k9143r2ch*****'),
  methodName?: string(name='MethodName'),
  parameters?: map[string]any(name='Parameters'),
}

model QueryInstanceSpec4ModifyShrinkRequest {
  applicationId?: string(name='ApplicationId', description='This parameter is required.', example='BE68D71ZY5YYIU9R'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='rm-uf66k9143r2ch*****'),
  methodName?: string(name='MethodName'),
  parametersShrink?: string(name='Parameters'),
}

model QueryInstanceSpec4ModifyResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='{
    "PolicyType": "",
    "AuthPrincipalOwnerId": "",
    "EncodedDiagnosticMessage": "",
    "AuthPrincipalType": "",
    "AuthPrincipalDisplayName": "",
    "NoPermissionType": "",
    "AuthAction": ""
  }'),
  code?: string(name='Code', example='200'),
  data?: {
    optionalValues?: [ 
      {
        label?: string(name='Label'),
        max?: double(name='Max'),
        min?: double(name='Min'),
        step?: double(name='Step'),
        value?: string(name='Value'),
      }
    ](name='OptionalValues'),
  }(name='Data'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='847C9D0A-BABD-589C-8A9C-6464409EDED9'),
  success?: boolean(name='Success', example='true'),
}

model QueryInstanceSpec4ModifyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryInstanceSpec4ModifyResponseBody(name='body'),
}

/**
 * @summary 查询变配规格列表
 *
 * @param tmpReq QueryInstanceSpec4ModifyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryInstanceSpec4ModifyResponse
 */
async function queryInstanceSpec4ModifyWithOptions(tmpReq: QueryInstanceSpec4ModifyRequest, runtime: Util.RuntimeOptions): QueryInstanceSpec4ModifyResponse {
  Util.validateModel(tmpReq);
  var request = new QueryInstanceSpec4ModifyShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.parameters)) {
    request.parametersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.parameters, 'Parameters', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.methodName)) {
    body['MethodName'] = request.methodName;
  }
  if (!Util.isUnset(request.parametersShrink)) {
    body['Parameters'] = request.parametersShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryInstanceSpec4Modify',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询变配规格列表
 *
 * @param request QueryInstanceSpec4ModifyRequest
 * @return QueryInstanceSpec4ModifyResponse
 */
async function queryInstanceSpec4Modify(request: QueryInstanceSpec4ModifyRequest): QueryInstanceSpec4ModifyResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryInstanceSpec4ModifyWithOptions(request, runtime);
}

model ReConfigApplicationRequest {
  appId?: string(name='AppId', example='Q2P4O9YSOKCT35L9'),
  variables?: string(name='Variables', example='{"${instance_type}":"ecs.c6.3xlarge"}'),
}

model ReConfigApplicationResponseBody = {
  code?: int32(name='Code', example='200'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', description='Id of the request', example='9656C816-1E9A-58D2-86D5-710678D61AF1'),
}

model ReConfigApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReConfigApplicationResponseBody(name='body'),
}

/**
 * @summary 重新配置应用
 *
 * @param request ReConfigApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReConfigApplicationResponse
 */
async function reConfigApplicationWithOptions(request: ReConfigApplicationRequest, runtime: Util.RuntimeOptions): ReConfigApplicationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.variables)) {
    body['Variables'] = request.variables;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReConfigApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 重新配置应用
 *
 * @param request ReConfigApplicationRequest
 * @return ReConfigApplicationResponse
 */
async function reConfigApplication(request: ReConfigApplicationRequest): ReConfigApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return reConfigApplicationWithOptions(request, runtime);
}

model ReleaseApplicationRequest {
  applicationId?: string(name='ApplicationId', description='The ID of the application.

This parameter is required.', example='7QSXFQW46ZNGOUDM'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='1600765710019'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='default'),
}

model ReleaseApplicationResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  data?: long(name='Data', description='The return value.', example='1'),
  message?: string(name='Message', description='The error message.', example='The resource does not exist.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='BFB7F5C8-FE7A-06CA-9F87-ABBF6B848F0C'),
}

model ReleaseApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseApplicationResponseBody(name='body'),
}

/**
 * @summary Releases the resources of an application.
 *
 * @param request ReleaseApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseApplicationResponse
 */
async function releaseApplicationWithOptions(request: ReleaseApplicationRequest, runtime: Util.RuntimeOptions): ReleaseApplicationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Releases the resources of an application.
 *
 * @param request ReleaseApplicationRequest
 * @return ReleaseApplicationResponse
 */
async function releaseApplication(request: ReleaseApplicationRequest): ReleaseApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseApplicationWithOptions(request, runtime);
}

model ValidateApplicationRequest {
  applicationId?: string(name='ApplicationId', description='The ID of the application.

This parameter is required.', example='02S7UU41WKJL7ERR'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='1600765710019'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmyjt3c5om3hi'),
}

model ValidateApplicationResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  data?: string(name='Data', description='The data of the application.', example='123'),
  message?: string(name='Message', description='The error message.', example='Success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model ValidateApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ValidateApplicationResponseBody(name='body'),
}

/**
 * @summary Verifies the resources of an application. ValidateApplication is an asynchronous operation. You can call the GetApplication operation to query the verification result.
 *
 * @param request ValidateApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ValidateApplicationResponse
 */
async function validateApplicationWithOptions(request: ValidateApplicationRequest, runtime: Util.RuntimeOptions): ValidateApplicationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationId)) {
    query['ApplicationId'] = request.applicationId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ValidateApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Verifies the resources of an application. ValidateApplication is an asynchronous operation. You can call the GetApplication operation to query the verification result.
 *
 * @param request ValidateApplicationRequest
 * @return ValidateApplicationResponse
 */
async function validateApplication(request: ValidateApplicationRequest): ValidateApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return validateApplicationWithOptions(request, runtime);
}

model ValuateApplicationRequest {
  applicationId?: string(name='ApplicationId', description='The operation that you want to perform. Set the value to ValuateApplication.

This parameter is required.', example='02S7UU41WKJL7ERR'),
  clientToken?: string(name='ClientToken', description='The ID of the resource group to which the application you want to query belongs.', example='1600765710019'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmyjt3c5om3hi'),
}

model ValuateApplicationResponseBody = {
  code?: int32(name='Code', description='The code of the query task.', example='200'),
  data?: long(name='Data', description='The ID of the request.', example='123'),
  message?: string(name='Message', description='Idempotent notation', example='Success'),
  requestId?: string(name='RequestId', description='The returned message.', example='A07FFDF2-78FA-1B48-9E38-88E833A93187'),
}

model ValuateApplicationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ValuateApplicationResponseBody(name='body'),
}

/**
 * @summary Queries the prices of resources of an application. You can call the GetApplication operation to obtain the query results.
 *
 * @param request ValuateApplicationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ValuateApplicationResponse
 */
async function valuateApplicationWithOptions(request: ValuateApplicationRequest, runtime: Util.RuntimeOptions): ValuateApplicationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.applicationId)) {
    body['ApplicationId'] = request.applicationId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ValuateApplication',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the prices of resources of an application. You can call the GetApplication operation to obtain the query results.
 *
 * @param request ValuateApplicationRequest
 * @return ValuateApplicationResponse
 */
async function valuateApplication(request: ValuateApplicationRequest): ValuateApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  return valuateApplicationWithOptions(request, runtime);
}

model ValuateTemplateRequest {
  areaId?: string(name='AreaId', description='The region ID.', example='cn-hangzhou'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.

This parameter is required.', example='1600765710019'),
  instances?: [ 
    {
      id?: string(name='Id', description='The instance ID.', example='vpc-bp1q56trhtaq40vlq5oj'),
      nodeName?: string(name='NodeName', description='The name of the application instance that is displayed on the diagram.', example='ecs'),
      nodeType?: string(name='NodeType', description='The instance type.', example='ecs'),
    }
  ](name='Instances', description='The instances to be replaced.'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the application belongs.', example='rg-acfmyjt3c5om3fi'),
  templateId?: string(name='TemplateId', description='The template ID.

This parameter is required.', example='0KSHPM6SJU03TNZP'),
  variables?: map[string]any(name='Variables', description='The parameter values that are contained in the template. If the template contains no parameter values, the default values are used.'),
}

model ValuateTemplateShrinkRequest {
  areaId?: string(name='AreaId', description='The region ID.', example='cn-hangzhou'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.

This parameter is required.', example='1600765710019'),
  instancesShrink?: string(name='Instances', description='The instances to be replaced.'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the application belongs.', example='rg-acfmyjt3c5om3fi'),
  templateId?: string(name='TemplateId', description='The template ID.

This parameter is required.', example='0KSHPM6SJU03TNZP'),
  variablesShrink?: string(name='Variables', description='The parameter values that are contained in the template. If the template contains no parameter values, the default values are used.'),
}

model ValuateTemplateResponseBody = {
  code?: string(name='Code', description='The HTTP status code.', example='200'),
  data?: {
    resourceList?: [ 
      {
        discountAmount?: double(name='DiscountAmount', description='The discount amount.', example='73'),
        error?: string(name='Error', description='The error message that is returned.', example='InvalidSaleComponentFault : The request not refer to the correct order sale component.'),
        nodeType?: string(name='NodeType', description='The resource type.', example='ecs'),
        originalPrice?: double(name='OriginalPrice', description='The original price.', example='83.0'),
        priceList?: [ 
          {
            discountAmount?: float(name='DiscountAmount', description='The discount amount.', example='82.99'),
            error?: string(name='Error', description='The error message that is returned.', example='ServiceUnavailable : The request has failed due to a temporary failure of the server.\\\\r\\\\nRequestId : 4AA302DB-3286-5589-8637-FF6D8507B7A9.'),
            nodeType?: string(name='NodeType', description='The resource type.', example='eip'),
            originalPrice?: float(name='OriginalPrice', description='The original price.', example='83.0'),
            priceUnit?: string(name='PriceUnit', description='The pricing unit.', example='USD'),
            promotionName?: string(name='PromotionName', description='The discount information.', example='The discount information.'),
            resourceId?: string(name='ResourceId', description='The resource ID.', example='1687225092'),
            tradePrice?: float(name='TradePrice', description='The price at which the transaction is made.', example='0.01'),
            type?: string(name='Type', description='Indicates whether the instance is newly created. Valid values:\\\\
1: The instance is newly created.\\\\
2: The instance already exists.\\\\
0: The price of the instance is not included.', example='"1"'),
          }
        ](name='PriceList', description='The information about the price.'),
        priceUnit?: string(name='PriceUnit', description='The pricing unit.', example='USD'),
        promotionName?: string(name='PromotionName', description='The discount information.', example='The discount information.'),
        tradePrice?: double(name='TradePrice', description='The price at which the transaction is made.', example='10.0'),
      }
    ](name='ResourceList', description='The result set of the inquiry.'),
  }(name='Data', description='The result of the inquiry.'),
  message?: string(name='Message', description='The error message returned if the request failed.', example='Success'),
  requestId?: string(name='RequestId', description='The request ID.', example='847C9D0A-BABD-589C-8A9C-6464409EDED9'),
}

model ValuateTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ValuateTemplateResponseBody(name='body'),
}

/**
 * @summary Queries the price of a template.
 *
 * @param tmpReq ValuateTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ValuateTemplateResponse
 */
async function valuateTemplateWithOptions(tmpReq: ValuateTemplateRequest, runtime: Util.RuntimeOptions): ValuateTemplateResponse {
  Util.validateModel(tmpReq);
  var request = new ValuateTemplateShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.instances)) {
    request.instancesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instances, 'Instances', 'json');
  }
  if (!Util.isUnset(tmpReq.variables)) {
    request.variablesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.variables, 'Variables', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.areaId)) {
    body['AreaId'] = request.areaId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instancesShrink)) {
    body['Instances'] = request.instancesShrink;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.variablesShrink)) {
    body['Variables'] = request.variablesShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ValuateTemplate',
    version = '2021-09-31',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the price of a template.
 *
 * @param request ValuateTemplateRequest
 * @return ValuateTemplateResponse
 */
async function valuateTemplate(request: ValuateTemplateRequest): ValuateTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return valuateTemplateWithOptions(request, runtime);
}

